#ifndef LEVELOBJECTSTREEWIDGET_H
#define LEVELOBJECTSTREEWIDGET_H

#include "appGlobals.h"
#include <QTreeWidget>
namespace Modes { class EditorMode; }
namespace LevelObjects { class AbstractLevelObject; class Level; }
class Document;

struct LevelObjectsTreeWidgetItem : QTreeWidgetItem
{
	QPointer<LevelObjects::AbstractLevelObject> object;
};

class LevelObjectsTreeWidget : public QTreeWidget
{
	Q_OBJECT

public:
	LevelObjectsTreeWidget(QWidget *parent);

	void setLevelEditorMode(QPointer<Modes::EditorMode> lem);
	void populateView();
private:
	LevelObjectsTreeWidgetItem* addLevelObject( QPointer<LevelObjects::AbstractLevelObject> lo );
	QPointer<Modes::EditorMode> m_levelEditorMode;
	QPointer<LevelObjects::Level> m_currentLevel;
signals:
	void selectedLevelObjectChanged(QPointer<LevelObjects::AbstractLevelObject> lo);
public slots:
	void onSelectedLevelChanged(QPointer<LevelObjects::AbstractLevelObject> level);
	void onLevelObjectAdded(QPointer<LevelObjects::AbstractLevelObject> lo);
	void onLevelObjectRemoved(QPointer<LevelObjects::AbstractLevelObject> lo);
	// handles signal from selection manager
	void onObjectSelectionChanged();
private slots:
	void onDocumentChanged(QPointer<Document> document);
	void onItemSelectionChanged();
	void onObjectDataChanged(QPointer<LevelObjects::AbstractLevelObject> lo);
};

#endif // LEVELOBJECTSTREEWIDGET_H
